package com.iot.auth.controller;

import com.dc3.common.bean.R;
import com.iot.auth.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/**
 * @Author 咕唧
 * @Date 2022/7/19 21:55
 * @Version 1.0
 */
@RestController
@RequestMapping("/token")
public class TokenController {

    private TokenService tokenService;

    @Autowired
    public void setTokenService(TokenService tokenService) {
        this.tokenService = tokenService;
    }

    @GetMapping("/check")
    public Mono<R> checkToken(String token) {
        return tokenService.checkToken(token).map(R::ok);
    }
}
